{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "f05e6fe2",
   "metadata": {},
   "source": [
    "| 功能 | 命令 | 快捷键 |\n",
    "| :--- | :--- | :--- |\n",
    "| Notebook: Collapse Cell Input | `notebook.cell.collapseCellInput` | `Ctrl + K Ctrl + C` |\n",
    "| Notebook: Collapse Cell Output | `notebook.cell.collapseCellOutput` | `Ctrl + K T` |\n",
    "| Notebook: Collapse Cell Output | `notebook.cell.collapseCellOutput` | `o` |"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "69136320",
   "metadata": {},
   "outputs": [],
   "source": [
    "for i in range(10):\n",
    "    print(i)  "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "fc3a1ad8",
   "metadata": {},
   "source": [
    "---"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "61ebd2b5",
   "metadata": {},
   "source": [
    "**1-02**  \n",
    "已知a = 2, b = 3，要求将 a 和 b 的值调换，并打印结果。(5.0score)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "754b3ec7",
   "metadata": {},
   "outputs": [],
   "source": [
    "a = 2\n",
    "b = 3\n",
    "temp = a\n",
    "a = b\n",
    "b = temp\n",
    "print(f\"After swap: a = {a}, b = {b}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "15d28b6b",
   "metadata": {},
   "outputs": [],
   "source": [
    "a = 2\n",
    "b = 3\n",
    "a, b = b, a\n",
    "print(f\"After swap: a = {a}, b = {b}\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c158fc89",
   "metadata": {},
   "source": [
    "---"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ae449ae9",
   "metadata": {},
   "source": [
    "**1-04**  \n",
    "让用户输入一个单词，并显示这个单词的长度。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8328b532",
   "metadata": {},
   "outputs": [],
   "source": [
    "word = input('Type a word:')\n",
    "length = len(word)\n",
    "print(f\"The length of '{word}' is {length}.\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "817d8e5e",
   "metadata": {},
   "source": [
    "---"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
